ActiveReports 11 Server User Guide
Migration PowerShell Module Sample
ActiveReports 11 Server User Guide > Samples and Walkthroughs > Samples > Migration PowerShell Module Sample

ActiveReports Server provides a Migration PowerShell Module sample to migrate resources (reports, models, roles, or other resources) from one server to another. This sample provides a list of commands to enable users to choose the resources to migrate. You can find the Migration PowerShell Module sample at the following location.

C:\ActiveReports 11 Server\SDK\Samples\Migration PowerShell Module

To run the sample

  1. Open the Windows PowerShell console.

  2. Enter the following command:
    cd "%\Samples\Migration PowerShell Module"

  3. In the PowerShell console, execute the following commands to start using the module:

    PS C:\> Set-ExecutionPolicy Unrestricted -Scope CurrentUser
    PS C:\> Import-Module .\ArsMigration.psd1

    Note: A warning message appears on executing the above command: "The names of some imported commands from the module 'ArsMigration' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb." To disable the warning message, execute the following command:

    PS C:\> Import-Module .\ArsMigration.psd1 -disablenamechecking

To get a list of available commands

PS C:\> Get-Command -Module ArsMigration

Available commands

Export-ArsData

Exports the data from ActiveReports Server.

Syntax Export-ArsData [[-Types] <String[]>] [-Path] <String> [[-Session] <PSObject>] [<CommonParameters>]
Parameters

-Types <String[]>: The types of resources to export. If not specified all supported resources are exported.

Note: To export all the roles, the roles Types parameter should be specified as '$roles'.

-Path <String>: The output file in which to store the exported archive.

-Session <PSObject>: The session object for the target server.

<CommonParameters>: This cmdlet supports these common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see About CommonParameters.

Required Parameter Path
Examples
  • Export-ArsData -Types reports,models,themes -Path data.zip
  • Export-ArsData -Path data.zip
  • Export-ArsData -Types reports,models,themes -Path data.zip -Session @{uri='http://another-ars-instance'; token='123...'}
  • Export-ArsData -Types '$roles' -Path data_roles.zip

Get-ArsList

Retrieves the list of resources of the specified type from ActiveReports Server.

Syntax Get-ArsList [-Type] <String> [[-Session] <PSObject>] [<CommonParameters>]
Parameters

-Type <String>: The type of resources to list.

-Session <PSObject>: The session object for the target server.

<CommonParameters>: This cmdlet supports these common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see About CommonParameters.

Required Parameter Type
Examples
  • Get-ArsList -Type Report
  • Get-ArsList -Type Report -Session @{uri='http://another-ars-instance'; token='123...'}

Get-ArsResource

Retrieves the content of the specified resource.

Syntax Get-ArsResource [-Id] <String> [-Type] <String> [[-Path] <String>] [-Description] [[-Session] <PSObject>] [<CommonParameters>]
Parameters

-Id <String>: The ID of the resource.

-Type <String>: The type of resource.

-Path <String>: The path to the output file.

-Description [<SwitchParameter>]:

-Session <PSObject>: The session object for the target server.

<CommonParameters>: This cmdlet supports these common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see About CommonParameters.

Required Parameter

Id

Type

Examples
  • Get-ArsResource -id 224234d34234 -Type report
  • Get-ArsResource -id 224234d34234 -Type report  -Path data.rdlx
  • Get-ArsResource -id 224234d34234 -Type report  -Path data.rdlx -Description:$true

Import-ArsData

Imports the previously exported data from the specified file to the target ActiveReports Server.

Syntax Import-ArsData [-Path] <String> [[-Session] <PSObject>] [<CommonParameters>]
Parameters -Path <String>: The path to the exported archive.

-Session <PSObject>: The session object for the target server.

<CommonParameters>: This cmdlet supports these common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see About CommonParameters.

Required Parameter Path
Examples
  • Import-ArsData -Path data.zip
  • Import-ArsData -Path data.zip -Session @{uri='http://another-ars-instance'; token='123...'}

Migrate-ArsResource

Migrates a single resource from one server to another.

Syntax Migrate-ArsResource [-Type] <String> [-Id] <String> [[-From] <PSObject>] [[-To] <PSObject>] [-SkipValidation] [<CommonParameters>]
Parameters

-Type <String>: The resource type to migrate.

-Id <String>: The resource ID of the resource being migrated.

-From <PSObject>: The session object specifying the server to migrate data from.

-To <PSObject>: The session object specifying the server to migrate data to.

-SkipValidation [<SwitchParameter>]

<CommonParameters>: This cmdlet supports these common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see About CommonParameters.

Required Parameter

Id

Type

Examples
  • Migrate-ARsResource -type report -id 582069eb5302
  • $prodServer=New-ArsSession -User admin -Password 2 -Uri http://another-ars-instance/ Migrate-ArsResource -Type report -Id 5809a9249497eb1298b4486b -To $prodServer
  • Migrate-ARsResource -type report -id 582069eb53020c3da8930f0a -To (new-arssession -user admin -password admin -uri http://another-ars-instance)
  • Migrate-ARsResource -type report -id 582069eb53020c3da8930f0a -from (new-arssession -user admin -password admin -uri http://another-ars-instance) -TO (new-arssession -user admin -password admin -uri http://another-ars-instance)

 

Migrate-ArsResources

Migrates all resources of the specified type.

Syntax Migrate-ArsResources [[-Type] <String[]>] [[-From] <PSObject>] [[-To] <PSObject>] [<CommonParameters>]
Parameters

-Type <String[]>: The resource type to migrate.

Note: To migrate all the roles, the roles Types parameter should be specified as '$roles'.

-From <PSObject>: The session object specifying the server to migrate data from.

-To <PSObject>: The session object specifying the server to migrate data to.                        

<CommonParameters>: This cmdlet supports these common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see About CommonParameters.

Required Parameter Null
Examples

 

New-ArsResource

Uploads the resource to the ActiveReports Server.

Syntax
  • New-ArsResource [-Name <String>] -Type <String> -Path <String[]> [-Overwrite] [-SkipValidation] [-Session<PSObject>] [<CommonParameters>]
  • New-ArsResource [-Name <String>] -Type <String> -Content <Array> [-Overwrite] [-SkipValidation] [-Session<PSObject>] [<CommonParameters>]
Parameters

-Name <String>: The name of the new resource.

-Type <String>: The type of the new resource.

-Path <String[]>: The path to the file to upload.

-Content <Array>: The contents of the resource as an array.

-Overwrite [<SwitchParameter>]: Specifies whether to overwrite any existing resource with the same name.

-SkipValidation [<SwitchParameter>]

-Session <PSObject>: The session object for target server.

<CommonParameters>: This cmdlet supports these common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see About CommonParameters.

Required Parameter

Type

Path

Content

Examples
  • New-ArsResource -Type report -Name Invoice -Path invoice.rdlx
  • New-ArsResource -Type report -Name Invoice -Path invoice.rdlx - Overwrite:$true
  • New-ArsResource -Type report -Name Invoice -Path invoice.rdlx - Overwrite:$true -Session @{uri='http://another-ars-instance'; token='123...'}
  • New-arsresource -name mymigrationreport -type report -content "<Content>"

New-ArsSession

Creates a session using the specified user credentials and ActiveReports Server URI.

Syntax New-ArsSession [-User] <String> [-Password] <String> [[-Uri] <String>] [-Default] [<CommonParameters>]            
Parameters

-User <String>: The user name for the session.

-Password <String>: The password of the specified user.

-Uri <String>: The server URI.

-Default [<SwitchParameter>]: Specifies whether to set the result as the default session for other cmdlets.

<CommonParameters>: This cmdlet supports these common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see About CommonParameters.

Required Parameter

User

Password

Examples

To get help about a specific command

PS C:> Get-Help <Command> -Full

To install the module for a current user and enable the module autoload

Place the module files into the following directory:

$Home\Documents\WindowsPowerShell\Modules\ArsMigration

See Also

Administration